package cn.edu.fzu.homemaking.controller;

import cn.edu.fzu.homemaking.api.SysApi;
import cn.edu.fzu.homemaking.web.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author jiebin
 * @Date 2023/4/13
 */
@RestController
@RequestMapping("/api/user/sys/")
@Api(tags = "省市区列表")
public class PcaController {

    @Resource
    private SysApi sysApi;

    @ApiOperation(value = "省份列表")
    @GetMapping("/listProvince")
    public Result listProvince() {
        return sysApi.listProvince();
    }


    @ApiOperation(value = "城市列表")
    @GetMapping("/listCity")
    public Result listCity(Long provinceId) {
        return sysApi.listCity(provinceId);
    }


    @ApiOperation(value = "地区列表")
    @GetMapping("/listArea")
    public Result listArea(Long cityId) {
        return sysApi.listArea(cityId);
    }

    @ApiOperation(value = "获取指定地区")
    @GetMapping("/getAreaById")
    public Result getAreaById(Long areaId) {
        return sysApi.getAreaById(areaId);
    }
}
